<template>
  <div :class="`welcome-chat${otherClass}`" :title="data['time']">
    <span class="name" :style="`color: ${data['nameColor']}`">{{ data['username'] }}</span>
    <span v-for="item in data['identities']" :class="`identity identity_${item}`"></span>
    <span class="content">{{ data['content'] }}</span>
    <div class="mask"></div>
  </div>
</template>

<script setup>
import {computed} from 'vue'

const props = defineProps({
  data: {
    type: Object,
    default: {}
  }
})
const otherClass = computed(() => {
  let result = ''
  for (let identity of props.data['identities'])
    result += ' welcome-chat_' + identity
  return result
})
</script>

<style scoped lang="scss">
.welcome-chat {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .6rem;
  margin: .2rem 0;
  background: var(--z-note-color);
  color: var(--z-light-color);

  .name {
    flex-shrink: 0;
    font-weight: bold;
    margin-right: .4rem;
  }

  .content {
    flex-shrink: 0;
    margin-left: .4rem;
  }

  .mask {
    position: absolute;
    width: 100%;
    height: 100%;
  }
}
</style>